from PyQt5.QtWidgets import QSystemTrayIcon, QMenu, QAction
from PyQt5.QtGui import QIcon
from src.utils.logger import logger

class SystemTrayIcon(QSystemTrayIcon):
    def __init__(self, parent=None):
        super().__init__(parent)
        # TODO: 添加应用图标
        # self.setIcon(QIcon("path/to/icon.png"))
        
        # 创建托盘菜单
        self.menu = QMenu()
        
        # 添加显示/隐藏动作
        show_action = QAction("显示", self)
        show_action.triggered.connect(parent.show)
        self.menu.addAction(show_action)
        
        hide_action = QAction("隐藏", self)
        hide_action.triggered.connect(parent.hide)
        self.menu.addAction(hide_action)
        
        # 添加分隔符
        self.menu.addSeparator()
        
        # 添加退出动作
        quit_action = QAction("退出", self)
        quit_action.triggered.connect(parent.close)
        self.menu.addAction(quit_action)
        
        # 设置托盘菜单
        self.setContextMenu(self.menu)
        
        # 设置托盘图标提示
        self.setToolTip("EasyShare - 视频发布助手")
        
        logger.info("系统托盘初始化完成")
